package com.powernode.ssm.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "login")
public class LoginFreqControlProperties {

    // ===== Token 默认过期时间 =====
    private int tokenExpireSeconds; // 单位：秒，默认 300（与原写死值一致）

    // ===== 登录频控参数 =====
    private FreqControl freqControl = new FreqControl();

    @Data
    public static class FreqControl {
        private Short shortConfig = new Short();
        private Long longConfig = new Long();
        private Block block = new Block();

        @Data
        public static class Short {
            private int maxAttempts;      // 短时间最大尝试次数，如 60s 内
            private int windowSeconds;   // 短时间窗口（秒）
        }

        @Data
        public static class Long {
            private int maxAttempts;     // 长时间最大尝试次数，如 10m 内
            private int windowMinutes;   // 长时间窗口（分钟）
        }

        @Data
        public static class Block {
            private int durationMinutes; // 封禁时长（分钟）
        }
    }
}